<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ page contentType="text/html;charset=UTF-8"%>
<jsp:useBean id="pageBean" scope="request" class="com.agileai.hotweb.domain.PageBean"/>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>项目计划</title>
<%@include file="/jsp/inc/resource.inc.jsp"%>
<script language="javascript">
function changeType(){
	var value =  $('input[name="PPA_TYPE"]:checked').val();
	if("GROUP" ==value){
		$("#startDate").css('display','none');
		$("#endDate").css('display','none');
		$("#state").css('display','none');
	}else if("TASK"==value){
		$("#startDate").css('display','');
		$("#endDate").css('display','');
		$("#state").css('display','');
	}
}
function saveAfterGoOn(){
	var startDate = new Date(($('#PPA_START_TIME').val()).replace(/-/g,"/"));
	var endDate = new Date(($('#PPA_END_TIME').val()).replace(/-/g,"/"));
     if(startDate > endDate){
	     writeErrorMsg('［开始日期］必须小于［结束日期］');
  	     return;
     }    
 	if(isValid($("#PPA_NAME").val())){ 
		postRequest('form1',{actionType:'saveAfterGoOn',showSplash:true,onComplete:function(responseText){
			hideSplash();
			if (responseText == 'success'){
				parent.loadPlanData();
				doSubmit({actionType:'prepareDisplay'})
			}else{
 				writeErrorMsg('操作失败');
			} 
		}}); 
 	}else{
 		writeErrorMsg('工作名称不能为空!');
	} 
}

function doSave(){
	var startDate = new Date(($('#PPA_START_TIME').val()).replace(/-/g,"/"));
	var endDate = new Date(($('#PPA_END_TIME').val()).replace(/-/g,"/"));
     if(startDate > endDate){
	     jAlert("［开始日期］必须小于［结束日期］");
  	     return;
     }    
	doSubmit({actionType:'save',target:'_parent'});
}
</script>
</head>
<body>
<form action="<%=pageBean.getHandlerURL()%>" name="form1" id="form1" method="post">
<%@include file="/jsp/inc/message.inc.jsp"%>
<div id="__ParamBar__" style="float: right;">&nbsp;</div>
<div id="__ToolBar__">
<table border="0" cellpadding="0" cellspacing="1">
<tr>
   <td onmouseover="onMover(this);" onmouseout="onMout(this);" class="bartdx" align="center" onclick="enableSave()" ><input value="&nbsp;" type="button" class="editImgBtn" id="modifyImgBtn" title="编辑" />编辑</td>
   <td onmouseover="onMover(this);" onmouseout="onMout(this);" class="bartdx" align="center" onclick="doSave()"><input value="&nbsp;" type="button" class="saveImgBtn" id="saveImgBtn" title="保存" />保存</td>
   <%if("insert".equals(pageBean.getOperaType())){ %>
   <td onmouseover="onMover(this);" onmouseout="onMout(this);" class="bartdx" align="center" onclick="saveAfterGoOn()"><input value="&nbsp;" type="button" class="saveGoOnImgBtn" id="saveImgBtn" title="保存" />连续保存</td>
   <% }%>
   <td onmouseover="onMover(this);" onmouseout="onMout(this);" class="bartdx" align="center" onclick="parent.PopupBox.closeCurrent()"><input value="&nbsp;" type="button" class="closeImgBtn" title="关闭" />关闭</td>
</tr>
</table>
</div>
<table class="detailTable" cellspacing="0" cellpadding="0">
<tr>
	<th width="100" nowrap>类别</th>
	<td onchange="changeType()">&nbsp;<%=pageBean.selectRadio("PPA_TYPE")%>
</td>
</tr>
<tr>
	<th width="100" nowrap>工作名称</th>
	<td><input id="PPA_NAME" label="工作名称" name="PPA_NAME" type="text" value="<%=pageBean.inputValue("PPA_NAME")%>" size="24" class="text" />
</td>
</tr>
<tr>
	<th width="100" nowrap>工作描述</th>
	<td><input id="PPA_CONTENT" label="工作描述" name="PPA_CONTENT" type="text" value="<%=pageBean.inputValue("PPA_CONTENT")%>" size="32" class="text" />
</td>
</tr>
<tr>
	<th width="100" nowrap>负责人</th>
	<td><input id="PPA_CHARGE" label="负责人" name="PPA_CHARGE" type="text" value="<%=pageBean.inputValue("PPA_CHARGE")%>" size="24" class="text" />
</td>
</tr>
<tr id="startDate">
	<th width="100" nowrap>开始日期</th>
	<td><input id="PPA_START_TIME" label="开始日期" readonly="readonly" name="PPA_START_TIME" type="text" value="<%=pageBean.inputTime("PPA_START_TIME")%>" size="24" class="text" /><img id="PPA_START_TIMEPicker" src="images/calendar.gif" width="16" height="16" alt="日期/时间选择框" />
</td>
</tr>
<tr>
	<th width="100" nowrap>工作人天</th>
	<td><input id="PPA_WORK_DAY" label="工作人天"  name="PPA_WORK_DAY" type="text" value="<%=pageBean.inputValue("PPA_WORK_DAY")%>" size="24" class="text" />
</td>
</tr>
<tr id="endDate">
	<th width="100" nowrap>结束日期</th>
	<td><input id="PPA_END_TIME" label="结束日期" readonly="readonly" name="PPA_END_TIME" type="text" value="<%=pageBean.inputTime("PPA_END_TIME")%>" size="24" class="text" /><img id="PPA_END_TIMEPicker" src="images/calendar.gif" width="16" height="16" alt="日期/时间选择框" />
</td>
</tr>
<tr id="state">
	<th width="100" nowrap>状态</th>
	<td>&nbsp;<%=pageBean.selectRadio("PPA_STATE")%>
</td>
</tr>
<tr>
	<th width="100" nowrap>排序</th>
	<td><input id="PPA_SORT" label="排序" name="PPA_SORT" type="text" value="<%=pageBean.inputValue("PPA_SORT")%>" size="24" class="text" />
</td>
</tr>
<tr>
	<th width="100" nowrap>创建人</th>
	<td><input id="PPA_CREATE_NAME" label="创建人" readonly="readonly" name="PPA_CREATE_NAME" type="text" value="<%=pageBean.inputValue("PPA_CREATE_NAME")%>" size="24" class="text" />
	<input id="PPA_CREATE" label="创建人" name="PPA_CREATE" type="hidden" value="<%=pageBean.inputValue("PPA_CREATE")%>" size="24" class="text" />
</td>
</tr>
<tr>
	<th width="100" nowrap>创建时间</th>
	<td><input id="PPA_CREATE_TIME" label="创建时间" readonly="readonly" name="PPA_CREATE_TIME" type="text" value="<%=pageBean.inputTime("PPA_CREATE_TIME")%>" size="24" class="text" />
</td>
</tr>
</table>
<input type="hidden" name="actionType" id="actionType" value=""/>
<input type="hidden" name="operaType" id="operaType" value="<%=pageBean.getOperaType()%>"/>
<input type="hidden" id="PPA_ID" name="PPA_ID" value="<%=pageBean.inputValue4DetailOrUpdate("PPA_ID","")%>" />
<input type="hidden" id="PI_ID" name="PI_ID" value="<%=pageBean.inputValue("PI_ID")%>" />
<input type="hidden" id="PPA_PID" name="PPA_PID" value="<%=pageBean.inputValue("PPA_PID")%>" />
</form>
<script language="javascript">
initCalendar('PPA_START_TIME','%Y-%m-%d','PPA_START_TIMEPicker');
initCalendar('PPA_END_TIME','%Y-%m-%d','PPA_END_TIMEPicker');
requiredValidator.add("PPA_NAME");
requiredValidator.add("PPA_CREATE");
requiredValidator.add("PPA_WORK_DAY");
requiredValidator.add("PPA_CREATE_TIME");
datetimeValidators[0].set("yyyy-MM-dd HH:mm").add("PPA_CREATE_TIME");
datetimeValidators[1].set("yyyy-MM-dd HH:mm").add("PPA_START_TIME");
numValidator.add("PPA_WORK_DAY");
datetimeValidators[2].set("yyyy-MM-dd HH:mm").add("PPA_END_TIME");
requiredValidator.add("PPA_SORT");
initDetailOpertionImage();
$(function(){
	changeType();
});
</script>
</body>
</html>
<%@include file="/jsp/inc/scripts.inc.jsp"%>
